<?php echo $this->Form->create('News', array('url'=>array('plugin'=>'calendar','controller'=>'news','action'=>'display')));?>

<table width="100%" cellpadding="0" cellspacing="0">
	<tr>
		<td align="right" valign="middle">
			<?php echo __('From date')?>
		</td>
		<td align="left" valign="middle">
			<?php echo $this->Form->input('news_from_date',array('label'=>false))?>
		</td>
		<td align="right" valign="middle">
			<?php echo __('To date')?>
		</td>
		<td align="left" valign="middle">
			<?php echo $this->Form->input('news_to_date',array('label'=>false))?>
		</td>	
		<td>
			<?php echo $this->Form->submit(__('Display events',true))?>
		</td>	
	</tr>
</table>
<?php echo $this->Form->end();?>

<?php		
echo $javascript->codeBlock("
$(function() {
		var dates = $( '#NewsNewsFromDate, #NewsNewsToDate' ).datepicker({
			defaultDate: '+1w',
			dateFormat: 'yy-mm-dd',
			onSelect: function( selectedDate ) {
				var option = (this.id == 'NewsNewsFromDate') ? 'minDate' : 'maxDate';
				var instance = $( this ).data( 'datepicker' );
				var date = $.datepicker.parseDate( instance.settings.dateFormat, selectedDate, instance.settings );
				dates.not( this ).datepicker( 'option', option, date );
			}
		});
	});
",$options = array('allowCache'=>false,'safe'=>false,'inline'=>false));
?>